/**
 * 
 */
package com.gite.nouette.admin.implementation.integrator.builder;

import com.gite.nouette.admin.contract.integrator.assembler.IAssemblerContainerModule;
import com.gite.nouette.admin.contract.integrator.assembler.IAssemblerHandlerModule;
import com.gite.nouette.admin.contract.integrator.builder.IBuilderManager;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryModel;
import com.gite.nouette.admin.contract.model.IManager;
import com.gite.nouette.admin.implementation.integrator.assembler.AssemblerContainerModuleImpl;
import com.gite.nouette.admin.implementation.integrator.assembler.AssemblerHandlerModuleImpl;

/**
 * @author Cyril
 * 
 */
public abstract class AbstractBuilderManager extends AbstractBuilder implements
		IBuilderManager {
	/**
	 * @param factoryModel
	 */
	public AbstractBuilderManager(IFactoryModel factoryModel) {
		super(factoryModel);
	}

	private IManager product = null;

	/**
	 * @return the product
	 */
	@Override
	public IManager getProduct() {
		return this.product;
	}

	/**
	 * @param product
	 *            the product to set
	 */
	private void setProduct(IManager product) {
		this.product = product;
	}

	@Override
	public void createNewProduct() {
		setProduct(getFactoryModel().getManager());
	}

	@Override
	public void buildContainerModule() {
		IAssemblerContainerModule assemblerContainerModule = new AssemblerContainerModuleImpl(
				getFactoryModel());
		assemblerContainerModule.setParentProduct(getProduct());
		assemblerContainerModule.run();
	}

	@Override
	public void buildHandlerModule() {
		IAssemblerHandlerModule assemblerHandlerModule = new AssemblerHandlerModuleImpl(
				getFactoryModel());
		assemblerHandlerModule.setParentProduct(getProduct());
		assemblerHandlerModule.run();
	}
}
